﻿using UnityEngine;
using NodeEditorFramework.Utilities;

namespace NodeEditorFramework.SkillComposer
{
	[System.Serializable]
	[Node(false, "Skill/String")]
	public class StringNode : Node
	{
		public const string ID = "StringNode";
		public override string GetID { get { return ID; } }

		public override Vector2 DefaultSize { get { return new Vector2(200, 50); } }

		[ValueConnectionKnob("String", Direction.Out, DataType.String)]
		public ValueConnectionKnob outputKnob;

		public string value = "abc";

		public override void NodeGUI()
		{
			value = RTEditorGUI.TextField(new GUIContent("Value", "Value"), value);
			outputKnob.SetPosition();

			if (GUI.changed)
				NodeEditor.curNodeCanvas.OnNodeChange(this);
		}

		public override bool Calculate()
		{
			outputKnob.SetValue<string>(value);
			return true;
		}

        public override object OutData()
        {
            return value;
        }
    }
}